// vite.config.ts
import { fileURLToPath, URL } from "node:url";
import { defineConfig, loadEnv } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0/node_modules/vite/dist/node/index.js";
import vue from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/@vitejs+plugin-vue@5.2.0_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0__vue@3.5.12_typescript@5.4.5_/node_modules/@vitejs/plugin-vue/dist/index.mjs";
import vueJsx from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/@vitejs+plugin-vue-jsx@4.1.0_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0__vue@3.5.12_typescript@5.4.5_/node_modules/@vitejs/plugin-vue-jsx/dist/index.mjs";
import { createHtmlPlugin } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/vite-plugin-html@3.2.2_vite@5.4.11_@types+node@20.17.6_sass@1.80.7_terser@5.36.0_/node_modules/vite-plugin-html/dist/index.mjs";
import { visualizer } from "file:///E:/mywork/2024/insurance/node_modules/.pnpm/rollup-plugin-visualizer@5.12.0_rollup@4.26.0/node_modules/rollup-plugin-visualizer/dist/plugin/index.js";
import path from "path";
var __vite_injected_original_dirname = "E:\\mywork\\2024\\insurance";
var __vite_injected_original_import_meta_url = "file:///E:/mywork/2024/insurance/vite.config.ts";
var vite_config_default = defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  console.log("VITE_BASE_URL:", env.VITE_BASE_URL);
  const plugins = [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes("wx-open-launch-weapp")
        }
      }
    }),
    vueJsx(),
    createHtmlPlugin({
      minify: true,
      /**
       * 在这里写entry后，你将不需要在`index.html`内添加 script 标签，原有标签需要删除
       * @default src/main.ts
       */
      entry: mode === "mobile" ? "src/main-m.ts" : "src/main-pc.ts",
      /**
       * 如果你想将 `index.html`存放在指定文件夹，可以修改它，否则不需要配置
       * @default index.html
       */
      // template: 'public/index.html',
      /**
       * 需要注入 index.html ejs 模版的数据
       */
      inject: {
        data: {},
        tags: []
      }
    })
  ];
  if (process.env.NODE_ENV === "production") {
    const filename = path.resolve(
      __vite_injected_original_dirname,
      `dist/${mode === "mobile" ? "mobile" : "pc"}/report.html`
    );
    plugins.push(
      visualizer({
        open: true,
        // 打包后自动打开报告
        filename,
        // 生成的报告文件名和路径
        template: "treemap"
        // 可选：报告的模板类型
      })
    );
  }
  return {
    base: env.VITE_BASE_URL,
    // 设置打包后的输入前缀
    plugins,
    resolve: {
      alias: {
        "@": fileURLToPath(new URL("./src", __vite_injected_original_import_meta_url)),
        "@ny-ui": path.resolve(__vite_injected_original_dirname, "./packages/src")
        // 设置别名
      }
    },
    build: {
      // 根据不同的目标设置输出目录
      outDir: mode === "mobile" ? "dist/mobile" : "dist/pc",
      rollupOptions: {
        input: path.resolve(__vite_injected_original_dirname, "index.html")
      }
    },
    server: {
      proxy: {
        // 代理 /api_cps 路径
        "/api_cps": {
          target: "http://cps.run4wd.com/api/",
          // 目标服务器
          changeOrigin: true,
          // 是否改变源
          rewrite: (path2) => path2.replace(/^\/api_cps/, "/")
          // 重写路径
        },
        "/api_op": {
          target: "http://47.99.75.3:8050/",
          changeOrigin: true,
          rewrite: (path2) => path2.replace(/^\/api_op/, "/")
          // 重写路径
        }
      }
    }
  };
});
export {
  vite_config_default as default
};
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsidml0ZS5jb25maWcudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImNvbnN0IF9fdml0ZV9pbmplY3RlZF9vcmlnaW5hbF9kaXJuYW1lID0gXCJFOlxcXFxteXdvcmtcXFxcMjAyNFxcXFxpbnN1cmFuY2VcIjtjb25zdCBfX3ZpdGVfaW5qZWN0ZWRfb3JpZ2luYWxfZmlsZW5hbWUgPSBcIkU6XFxcXG15d29ya1xcXFwyMDI0XFxcXGluc3Vy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